package br.edu.fanor.esfinge.dao.impl;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import br.edu.fanor.esfinge.dao.AutorDAO;
import br.edu.fanor.esfinge.entity.Autor;

@Stateless(mappedName="ejb/AutorDAO")			
public class AutorDAOImpl implements AutorDAO{

	@PersistenceContext
	public EntityManager emr;
	
	@Override
	public Autor inserir(Autor autor) {
		emr.persist(autor);
		return autor;
	}

	@Override
	public Autor buscarId(long id) {
		return emr.find(Autor.class, id);
	}

	@Override
	public void remover(Autor autor) {
		emr.remove(autor);
		
	}

}
